package com.yc.service;

import com.alibaba.fastjson.JSONObject;
import com.yc.entity.Order;
import com.yc.entity.OrderEntity;
import com.yc.mapper.OrderEntityMapper;
import com.yc.mapper.OrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yangc91@bngrp.com
 * @date 2020/8/6 14:11
 */
@Service
@Slf4j
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private OrderEntityMapper orderEntityMapper;
    public List<OrderEntity> getAllOrder() {
        return orderMapper.getAllOrder();
    }

    public String insert(Long id) {
        orderMapper.insert(id);
        return "success";
    }

    public void addOrder(Order order) {
        log.info("保存订单实体:{}", JSONObject.toJSONString(order));
        orderEntityMapper.insert(order);
    }
}
